package com.suse.ecommerce.dao;

import com.suse.ecommerce.pojo.Seckill;
import com.suse.ecommerce.pojo.SeckillExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

public interface SeckillMapper {
    int countByExample(SeckillExample example);

    int deleteByExample(SeckillExample example);

    int deleteByPrimaryKey(Long id);

    int insert(Seckill record);

    int insertSelective(Seckill record);

    List<Seckill> selectByExample(SeckillExample example);

    Seckill selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") Seckill record, @Param("example") SeckillExample example);

    int updateByExample(@Param("record") Seckill record, @Param("example") SeckillExample example);

    int updateByPrimaryKeySelective(Seckill record);

    int updateByPrimaryKey(Seckill record);

    List<Seckill> querySeckillByTime(Integer timeId);

    Seckill querySeckillById(long seckillId);

    @Update("update tb_seckill set stockCount = stockCount-1 where id=#{seckillId} and stockCount>0")
    int updateStock(@Param("seckillId")Long seckillId);
}